
package code.main
{
	import code.main.core.net.NetManager;
	import code.untils.GameConst;
	
	import flash.external.ExternalInterface;

	/**
	 *程序 数据 
	 * @author Yuri
	 * 
	 */
	public class AppData
	{
		/**
		 *用户自己的ID 
		 */
		public static var myId:String = "338945766253931";
		//100002220877223(周) 100004202706649(梁倩)  100001720648262(徐)
		/** 是否是自己的场景(自己家true 访问好友是为 false)
		 */
		public static var isMyScene:Boolean = true;
		/**
		 *后台接口url 原始地址 
		 */
		private static var dataUrl:String = "http://121.40.72.76/version/dev_test/j7/j7.php?/";
//		private static var dataUrl:String = "http://api.niuhome.com/j7/j7.php?";
//		private static var dataUrl:String = "http://dessertshop-fb.shinezone.com/version/V0.6.8.1001/j7/j7.php?";
//		private static var dataUrl:String = "http://172.17.0.76/version/dev_main/j7/j7.php?";
//		private static var dataUrl:String = "https://dessertshop-german-fb.shinezone.com/version/V0.5.8.2002/j7/j7.php?";
//		private static var dataUrl:String = "https://dessertshop-german-fb.shinezone.com/version/V0.4.2.2000/j7/j7.php?";
		/**
		 *配置表目录 
		 */
//		public static var configUrl:String="http://172.17.0.76/version/dev_main/j7/app/configs/"+language+"/";
//		public static var configUrl:String="http://dessertshop-fb.shinezone.com/version/V0.6.8.1001/j7/app/configs/"+language+"/";
		public static var configUrl:String="files/config/";
		
//		public static var configUrl:String="https://dessertshop-german-fb.shinezone.com/version/V0.5.8.2002/j7/app/configs/"+language+"/";
		/**
		 * 平台用的（暂 读取好友需要） 
		 */
		public static var accessToken:String="CAAG8jdWqI1MBAEU8xuaOAVYXhcz7t6MJMTRoZChWvZCaQrm2Dh8Rc1YEls4JUuBDouLzF9aqQQW2442KUHwMtwxZBEJZAtBaUdX3eU4hGVn1TkkxuniTILKJQhh10bWZBS3Am7u24RSZBbmUZB1ks0QJZBVInQg7Fs6Jr8uudYjYxwKZCbjTvWTaLCetWt8Q0QQwZD";
		/**
		 *语言版本 
		 */
		public static var language:String = "en_us"; //en_us zh_tw de_de fr_fr
		
		/**
		 *标示 	
		 */
		public static var signedRequest:String;
		
		/**
		 *是否新手 
		 */
		public static var isNew:Boolean = false;
		
		public static var guideStep:int;
		
		/**
		 * 在首次加载过程中输出log的截止时间
		 */		
		public static var firstFileLoadLogDate:String = '2013/10/23';
		
		/**
		 *后台交互接口url 带Token
		 */
		public  static var gateUrl:String = "";
		/**
		 *后台日志接口url 带Token
		 */
		public static var logUrl:String = "";
		/**
		 * 资源请求Url
		 */
		public static var resourceUrl:String = "../";
		
		/**
		 * 延迟时间(baseinit-返回服务器时间)s
		 */
		public static var iDelayTime:int;
		/**
		 *当前目录 
		 */	
		public static var fileUrl:String="";
		
		/**
		 *版本 
		 */
		public static var version:String = "";
		private static var _token:String = "218d681960530e8cba3bcc6af2236377";
		/**
		 *分析swf获取的loaderinfo parameters 
		 * @param obj
		 * 
		 */
		public static function analysisSwfParameters(obj:Object):void{
			if(obj.hasOwnProperty("signed_request")) signedRequest = obj.signed_request;
			if(obj.hasOwnProperty("dataurl")) dataUrl = obj.dataurl;
			if(obj.hasOwnProperty("cdnurl")) resourceUrl = obj.cdnurl;
			if(obj.hasOwnProperty("uid")) myId = obj.uid;
			if(obj.hasOwnProperty("fileurl")) fileUrl = obj.fileurl;
			if(obj.hasOwnProperty("isnew")) isNew = int(obj.isnew)==1;
//			if(obj.hasOwnProperty("token")) token = obj.token;
			if(obj.hasOwnProperty("access_token")) accessToken = obj.access_token;
			if(obj.hasOwnProperty("lang")) language = obj.lang;
			if(obj.hasOwnProperty("guideStep")) guideStep = int(obj.guideStep);
			if(obj.hasOwnProperty("version")) version = "_"+obj.version;
			if(obj.hasOwnProperty("configurl")) configUrl = obj.configurl;
			token = "218d681960530e8cba3bcc6af2236377";//a60f80c2a8fc1752be86d7e43e0569f1
		}

		/**
		 * token
		 */
		public static function set token(value:String):void
		{
			/*if(GameConst.isLocal){
				_token = "218d681960530e8cba3bcc6af2236377";
			}else{*/
				_token = value;
//			}
			if(GameConst.isLocal){
				gateUrl =dataUrl+"/Comd&token="+_token+"&fcuid="+myId+"&lang="+language;
				logUrl =dataUrl+"/LogComd&token="+_token+"&fcuid="+myId+"&lang="+language;
			}else{
				gateUrl = dataUrl+"/Comd&token="+_token+"&signed_request="+signedRequest+"&lang="+language+"&sim_id="+myId;
				logUrl = dataUrl+"/LogComd&token="+_token+"&signed_request="+signedRequest+"&lang="+language+"&sim_id="+myId;
			}
			NetManager.getInstance().net.requestURL = gateUrl;
			if (ExternalInterface.available) ExternalInterface.call("global.setLoginToken", value);
		}
		
	}
}